import { SkillListPanel } from "../SkillListPanel";
import { ObjCreate } from "../../common/ObjCreate";
import { TilePanel } from "../../equipment/TilePanel";
import { SkillItemMarry } from "./SkillItemMarry";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { SkillInfo } from "../../../model/SkillInfo";
type int = number;
//class SkillMarryMapPanel
    
    export  class SkillMarryMapPanel extends SkillListPanel
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ initUI(): void
        {
            _bgBmp = ObjCreate.createBg(0, 0, 253, 389, this);
            this._listPanel = new TilePanel();
            this._listPanel.verticalGap = 3;
            this._listPanel.horizontalGap = 6;
            this._listPanel.move(0, 0);
            this._listPanel.setSize(252, 385);
            this._listPanel.x = 7;
            this._listPanel.y = 7;
            this._listPanel.columnWidth = 238;
            this._listPanel.rowHeight = 60;
            this._listPanel.setStyle("cellRenderer", SkillItemMarry);
            this.addChild(this._listPanel);
            return;
        }

        public /* override */ initSkill(arg1: Array<any>): void
        {
            super.initSkill(arg1);
            if (this._dataProvider) 
            {
                this._dataProvider.removeAll();
            }
            else 
            {
                this._dataProvider = new DataProvider();
            }
            this._dataProvider.addItems(arg1);
            this._listPanel.dataProvider = this._dataProvider;
            initCallLater();
            return;
        }

        protected /* override */ refreshSkill(arg1: int, arg2: SkillInfo): void
        {
            super.refreshSkill(arg1, arg2);
            this._listPanel.replaceItemAt(arg2, (arg1 - 1));
            this._listPanel.invalidateItemAt((arg1 - 1));
            return;
        }

        public /* override */ itemClick(arg1: int): void
        {
            super.itemClick(arg1);
            if (arg1 == this._clickIndex) 
            {
                return;
            }
            this._clickIndex = arg1;
            this._listPanel.selectedIndex = (arg1 - 1);
            return;
        }

        public /* override */ updateSkill(arg1: SkillInfo): SkillInfo
        {
            super.updateSkill(arg1);
            arg1.levelUpAbleShow = false;
            arg1.levelUpAbleEffect = false;
            this._listPanel.replaceItemAt(arg1, (arg1.position - 1));
            this._listPanel.invalidateItemAt((arg1.position - 1));
            return null;
        }

        public /* override */ startCoolDown(arg1: SkillInfo): void
        {
            super.startCoolDown(arg1);
            this._listPanel.invalidateItemAt((arg1.position - 1));
            return;
        }

        protected /* var */_listPanel: TilePanel;

        protected /* var */_dataProvider: DataProvider;

        protected /* var */_clickIndex: int;
    }
